<template>
  <div class="size-container" @click="showSize = !showSize">
    {{ fontSize }}
    <transition name="el-fade-in-linear">
      <div v-show="showSize" class="popver-container" :class="{
        'pc': className == 'pc'
      }">
        <el-slider
          v-model="fontSize"
          :show-tooltip="false"
          :min="8"
          :max="40"
          style="width: 200px;"
          v-on="new$listeners"
        >
        </el-slider>
      </div>
    </transition>
    <div class="close" v-show="showSize"></div>
  </div>
</template>

<script>
export default {
  name: 'FontSize',
  props: {
    className: {
      type: String,
      default: 'mobile'
    }
  },
  data() {
    return {
			showSize: false,
			fontSize: 20,
    }
  },
  computed: {
    new$listeners() {
      return Object.assign(this.$listeners, {
       //在这里覆盖原有的业务逻辑事件
      }) || {}
    },
  },
  methods: {
  }
}
</script>

<style lang='scss' socped>
  .size-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    margin-right: 20px;
    .popver-container {
      position: absolute;
      bottom: 130px;
      left: 50%;
      transform: translateX(-50%) rotate(-90deg);
      background-color: #fff;
      padding: 6px 12px;
      border-radius: 6px;
      z-index: 2;
      >::after {
        position: absolute;
        content: "";
        width: 12px;
        height: 0;
        left: -12px;
        top: 50%;
        transform: translateY(-50%);
        border-top: solid 12px transparent;
        border-right: solid 12px #fff;
        border-bottom: solid 12px transparent;
      }
      &.pc {
        transform: translateX(-50%);
        bottom: 40px;
        background-color: #f6f6f6;
        >::after {
          position: absolute;
          content: "";
          width: 12px;
          height: 0;
          left: 50%;
          top: 50px;
          transform: translateX(-50%);
          border-top: solid 12px #f6f6f6;
          border-right: solid 12px transparent;
          border-left: solid 12px transparent;
        }
      }
    }
    .close {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      // pointer-events: none;
    }
  }
</style>